Skip to content

feat: preserve unknown config keys in extensions#1712

Merged
rlundeen2 merged 4 commits into
microsoft:mainfrom
extrasmall0:fix-config-loader-extensions
May 13, 2026
Merged

feat: preserve unknown config keys in extensions#1712
rlundeen2 merged 4 commits into
microsoft:mainfrom
extrasmall0:fix-config-loader-extensions

Conversation

@extrasmall0
Copy link
Copy Markdown
Contributor

Summary

  • add an extensions field to ConfigurationLoader for downstream-owned config
  • route unknown top-level keys from from_dict() into extensions instead of raising TypeError
  • allow callers to merge explicit extensions with unknown top-level keys
  • add coverage for passthrough, merge, and validation behavior

Testing

  • uv run pytest tests/unit/setup/test_configuration_loader.py -q

Closes #1652

@extrasmall0
Copy link
Copy Markdown
Contributor Author

extrasmall0 commented May 12, 2026

Quick follow-up with the practical use case that motivated this patch: we hit a downstream config extension point where product-specific keys need to survive a round-trip through ConfigurationLoader without weakening validation for the known schema. This change keeps the current validation behavior for supported fields, but stops rejecting extra top-level keys that are intentionally owned by an extension. The scope is still limited to config loading plus the targeted tests in tests/unit/setup/test_configuration_loader.py.

@rlundeen2 rlundeen2 self-assigned this May 13, 2026
rlundeen2 and others added 3 commits May 12, 2026 18:09
…ensions

# Conflicts:
#	pyrit/setup/configuration_loader.py
- Swap merge order so explicit extensions dict values take priority
  over unknown top-level keys when both have the same key name
- Add test_from_dict_explicit_extensions_wins_on_collision

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rlundeen2 rlundeen2 enabled auto-merge May 13, 2026 01:12
@rlundeen2 rlundeen2 added this pull request to the merge queue May 13, 2026
Merged via the queue into microsoft:main with commit 3afecc2 May 13, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make ConfigurationLoader tolerate unknown top-level keys for downstream framework configs

2 participants